home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d1 / marxmenu.arc / LEVEL1.MNU < prev    next >
Text File  |  1991-03-27  |  48KB  |  1,923 lines

  1. Comment
  2. =======================================
  3. Level 1 Menu
  4.  
  5. Level 1 Menu requires a data file, in which it stores information about
  6. the choices. It has password capabilites to keep the user Out of the
  7. modify and exit to dos choices.
  8.  
  9. * Warning * Messing with the *.dat file will mess up your program !!!!
  10.  
  11. (C) CopyRight 1990 Computer Tyme * All rights Reserved
  12. (417)866-1222
  13.  
  14. Programmed by Kevin Moore
  15.  
  16. =======================================
  17. EndComment
  18.  
  19. Var
  20.    MenuInverseForeColor MenuInverseBackColor MainScreenForeColor
  21.    Menu                 NewProgram           Subs
  22.    TotalSubs            LongestSubLine       MenuHeader
  23.    MenuTitle            ModifyPassWord       ExitToDosPassWord
  24.    ChoicePtr            Offset               %ThisDirectory
  25.    LongestItem          FileSaved            MenuForeColor
  26.    MenuBackColor        MenuBorderForeColor  MenuBorderBackColor
  27.    MenuHeaderForeColor  MenuHeaderBackColor  ExplodeStatus
  28.    ShadowStatus         SoundStatus          Index
  29.    I                    In                   TmpSt
  30.    BorderStyle          BottomOfScreenText   MainScreenBackColor
  31.    TmpWd                Height               Width
  32.    ScreenArr            ClockForeColor       ClockBackColor
  33.  
  34. Var
  35.    TitleRow             MsgRow               BatEditor
  36.    Count                DosUtilPassWord      %ThisDrive
  37.    UtilPassWord         MenuName             UtilForeColor
  38.    UtilBackColor        UtilBorderForeColor  UtilBorderBackColor
  39.    UtilInverseForeColor UtilInverseBackColor UtilHeaderForeColor
  40.    UtilHeaderBackColor  TitleForeColor       TitleBackColor
  41.    TitleBorderForeColor TitleBorderBackColor TitleInverseForeColor
  42.    TitleInverseBackColor TitleHeaderForeColor TitleHeaderBackColor
  43.    BackDropCharacter    TitleExplodeStatus   TitleShadowStatus
  44.    TitleSoundStatus     UtilExplodeStatus    UtilShadowStatus
  45.    UtilSoundStatus      UtilBorderStyle      TitleBorderStyle
  46.    ConBlankTime         ConLockword          ConBlankMessage
  47.    VerNo                MMActive             sdf
  48.    SubListName          DirScanProg
  49.  
  50. Const
  51.    None = 1  Single = 2 Double = 3 Block = 4
  52.    Larr = 19 Rarr   = 4 Uarr   = 5 Darr  = 24
  53.    Version      = 'Version 1.6'
  54.    ProgramName  = 'Level1 Menu '
  55.    CopyRightMsg = '(C) CopyRight 1990 Computer Tyme * All rights reserved.'
  56.    MMenu = 1  Util = 2 Title = 3
  57.  
  58. Qualifier
  59.    InUse Description Path Name PassWord Parameters Pause
  60.  
  61.  
  62. %ThisDrive = left(path,2)
  63.  
  64. MasterEnvironment
  65.  
  66. MenuName = ReadEnv('MENU')
  67.  
  68. if MenuName > ''
  69.    If ExistFile(MenuName)
  70.       LoadData
  71.    else
  72.       InitilizeData
  73.    endif
  74. else
  75.    if ExistFile('MENU.DAT')
  76.       MenuName = Path + '\MENU.DAT'
  77.       SetEnv('MENU=' + MenuName)
  78.       LoadData
  79.    else
  80.       MenuName = Path + '\MENU.DAT'
  81.       SetEnv('MENU=' + MenuName)
  82.       InitilizeData
  83.    endif
  84. endif
  85.  
  86. DirScanProg = ExistOnPath('PIPEDIR.EXE')
  87. if DirScanProg = ''
  88.    DirScanProg = ExistOnPath('WHEREIS.EXE');
  89.    if DirScanProg = ''
  90.       Abort('You will need WHEREIS.EXE from the DOS TOOLBOX to run this program!')
  91.    endif
  92. endif
  93.  
  94. if pos('PIPEDIR',DirScanProg) > 0 then DirScanProg = DirScanProg + '/W'
  95.  
  96. if ExistOnPath('D.EXE') = ''
  97.    Abort('You will need D.EXE from the DOS TOOLBOX to run this program!')
  98. endif
  99.  
  100. SubListName = GetSubListName
  101.  
  102. ShadowColor (grey, black)
  103.  
  104. DrawTop
  105. DrawBottom ('F1 - Help * ? - Mini Help')
  106.  
  107. While ChoicePtr = 0
  108.    NoChoices
  109. EndWhile
  110.  
  111.  
  112. Draw
  113. Main
  114.  
  115. ;------ Uses same name as Pick Directory
  116.  
  117. Procedure GetSubListName
  118. var SearchSt W ListName
  119.    SearchSt = ReadEnv('PD.EXE')
  120.    if SearchSt <> ''
  121.       W = pos('/$',SearchSt)
  122.       if W > 0
  123.          SearchSt = Mid(SearchSt,W + 2,255)
  124.          ListName = NextWord(SearchSt)
  125.       endif
  126.    endif
  127.    if ListName = ''
  128.       ListName = ExistOnPath('PD.PIC')
  129.       if ListName = ''
  130.          ListName = CleanFileName(Path + '\' + 'PD.PIC')
  131.          SetEnv('PD.EXE=' + ReadEnv('PD.EXE') + '/$' + ListName)
  132.       endif
  133.    endif
  134.    Return ListName
  135. EndProc
  136.  
  137. { Menus }
  138.  
  139. Procedure AdvancedOptions
  140. Var  Select
  141.  
  142.    MakeBox('Advanced Options', 0, 10, 29, 8, Util)
  143.  
  144.    Writeln("  A - PassWord")
  145.    Writeln("  B - Parameters")
  146.    Writeln("  C - Pause after execute")
  147.    Writeln("  D - Path")
  148.    Writeln("  E - Program")
  149.    Write  ("  F - Create/Edit Bat File")
  150.    UseArrows On
  151.  
  152.  
  153.    Repeat
  154.       Select = GetKey
  155.       If Select = 'A'
  156.          FileSaved = False
  157.          Menu[Index].PassWord = ReadTextLine('PassWord', Menu[Index].PassWord, 35, 16)
  158.       EndIf
  159.       If Select = 'B'
  160.          FileSaved = False
  161.          Menu[Index].Parameters = ReadTextLine('Program Parameters', Menu[Index].Parameters, 60, 16)
  162.       EndIf
  163.       If Select = 'C'
  164.          FileSaved = False
  165.          if AskYesNo('Pause after execute?', 16)
  166.             Menu[Index].Pause = True
  167.          else
  168.             Menu[Index].Pause = False
  169.          Endif
  170.       EndIf
  171.       if Select = 'D' then Menu[Index].Path = ReadTextLine('Edit Path', Menu[Index].Path, 50, 16)
  172.       if Select = 'E' then Menu[Index].Name = ReadTextLine('Edit Program', Menu[Index].Name, 50, 16)
  173.  
  174.       if Select = 'F' then EditBat
  175.    Until Select = ESC
  176.  
  177.    EraseTopWindow
  178.  
  179. EndProc ;AdvancedOptions
  180.  
  181. ;---
  182.  
  183. Procedure Backup
  184. Var Select BackUpPath
  185.  
  186.    MakeBox('Backup Hard Disk', 26, 17, 30, 4, Util)
  187.    Writeln('  A - Entire Disk')
  188.    Write  ('  B - One Directory')
  189.  
  190.    Repeat
  191.       Select = GetKey
  192.       if Select = 'A'
  193.          ChDir('\')
  194.          Execute('BACKUP C: A: /S')
  195.       endif
  196.       if Select = 'B'
  197.          BackupPath = ChooseDirectory
  198.          Chdir(BackUpPath)
  199.          Execute('BACKUP C: A:')
  200.       endif
  201.       if Select = F1 then Help
  202.    Until Select = ESC
  203.  
  204.    EraseTopWindow
  205.  
  206. EndProc ;BackUp
  207.  
  208. ;---
  209.  
  210. Procedure Colors (WinNum)
  211. Var Select
  212.  
  213.    MakeBox('Colors', 36, 11, 17, 6, Util)
  214.    Writeln("  A - Inside ")
  215.    Writeln("  B - Border ")
  216.    Writeln("  C - Header ")
  217.    Write  ("  D - Inverse ")
  218.  
  219.    Repeat
  220.       Select = GetKey
  221.       if Select = 'A'
  222.           if WinNum = MMenu then ChooseColors (MenuForeColor , MenuBackColor, 1)
  223.           if WinNum = Util  then ChooseColors (UtilForeColor, UtilBackColor, 9)
  224.           if WinNum = Title then ChooseColors (TitleForeColor, TitleBackColor, 13)
  225.       endif
  226.       if Select = 'B'
  227.           if WinNum = MMenu then ChooseColors (MenuBorderForeColor, MenuBorderBackColor, 2)
  228.           if WinNum = Util  then ChooseColors (UtilBorderForeColor, UtilBorderBackColor, 10)
  229.           if WinNum = Title then ChooseColors (TitleBorderForeColor, TitleBorderBackColor, 14)
  230.       endif
  231.       if Select = 'C'
  232.           if WinNum = MMenu then ChooseColors (MenuHeaderForeColor, MenuHeaderBackColor, 4)
  233.           if WinNum = Util  then ChooseColors (UtilHeaderForeColor, UtilHeaderBackColor, 12)
  234.           if WinNum = Title then ChooseColors (TitleHeaderForeColor, TitleHeaderBackColor, 16)
  235.       endif
  236.       if Select = 'D'
  237.           if WinNum = MMenu then ChooseColors (MenuInverseForeColor, MenuInverseBackColor, 3)
  238.           if WinNum = Util  then ChooseColors (UtilInverseForeColor, UtilInverseBackColor, 11)
  239.           if WinNum = Title then ChooseColors (TitleInverseForeColor, TitleInverseBackColor, 15)
  240.       endif
  241.    Until Select = ESC
  242.  
  243.    EraseTopWindow
  244.  
  245. EndProc ;ColorsMenu
  246.  
  247. ;---
  248.  
  249. Procedure DosUtilities
  250. Var
  251.    Select Parm
  252.  
  253.    ClearScreenFirst On
  254.    ClearScreenOnExit On
  255.  
  256.    MakeBox('Dos Utilities', 5, 8, 25, 11, Util)
  257.    Writeln('  A - Format Floppies')
  258.    Writeln('  B - Directory')
  259.    Writeln('  C - Free')
  260.    Writeln('  D - Backup Hard Disk')
  261.    Writeln('  E - Directory Master')
  262.    Writeln('  F - Pick Directory')
  263.    Writeln('  G - Whereis')
  264.    Writeln('  H - DOS Shell')
  265.    Write  ('  I - DOS command')
  266.  
  267.  
  268.    Repeat
  269.       Select = GetKey
  270.       if Select = 'A' then Format
  271.       if Select = 'B'
  272.          Parm = ReadTextLine('Directory Mask', path + '\*.*', 60, 10)
  273.          if Parm = '' then Parm = path + '\*.*'
  274.          if LastKey = Char(13)
  275.             if ExistOnPath('D.EXE') > ''
  276.                Execute('D ' + Parm + ' /W')
  277.             else
  278.                Execute('DIR ' + Parm + ' | more')
  279.             endif
  280.          endif
  281.       endif
  282.       if Select = 'C'
  283.          Parm = ReadTextLine('Drive', left(path,2), 60, 10)
  284.          if LastKey = char(13)
  285.             if ExistonPath('FREE.EXE') > ''
  286.                Execute('FREE ' + Parm + ' | More')
  287.             else
  288.                Execute('Chkdsk ' + Parm + ' | More')
  289.             endif
  290.          endif
  291.       endif
  292.       if Select = 'D' then BackUp
  293.       if Select = 'E'
  294.          if ExistOnPath('DM.COM') > ''
  295.             Execute('DM')
  296.          else
  297.             Error('Could not find Directory Master!')
  298.          endif
  299.       endif
  300.       if Select = 'F'
  301.          if ExistOnPath('PD.EXE') > ''
  302.             Execute('PD')
  303.          else
  304.             Error('Could not find Pick Directory!')
  305.          endif
  306.       endif
  307.       if Select = 'G'
  308.          if DirScanProg > ''
  309.             Parm = ReadTextLine(' Mask (*.doc) ', '', 60, 10)
  310.             if Lastkey = Char(13) then Execute('WHEREIS ' + Parm + ' | more ')
  311.          else
  312.             Error('Could not find Whereis!')
  313.          endif
  314.       endif
  315.       if Select = 'H'
  316.          if ExistOnPath('DOLIST.EXE') > ''
  317.             Execute('DOLIST')
  318.          else
  319.             Execute('COMMAND')
  320.          endif
  321.       endif
  322.  
  323.       if Select = 'I'
  324.          Parm = ReadTextLine('DOS Command', '', 60, 10)
  325.          if LastKey = Char(13)
  326.             Execute(Parm)
  327.          endif
  328.       endif
  329.    Until Select = ESC
  330.  
  331.    EraseTopWindow
  332.  
  333. EndProc ;DosUtilities
  334.  
  335. ;---
  336.  
  337. Procedure Edit
  338. Var
  339.    x y spc = '                               ' Select
  340.  
  341.    FileSaved = False
  342.  
  343.    if not ExistFile SubListName
  344.       ScanDirectories
  345.    else
  346.       ReadTextFile SubListName Subs
  347.    endif
  348.    TotalSubs = NumberOfElements(Subs)
  349.    LongestSubLine = LongestLine
  350.  
  351.    if ExplodeStatus then Explode Off
  352.    DrawBottom ('ESC - Main Screen * F4 - Utilities')
  353.    if ExplodeStatus then Explode On
  354.  
  355.    RedrawSelections
  356.  
  357.    Repeat
  358.       Select = GetKey
  359.       if (Select >= 'A') and (Select <= 'Z')
  360.          ChoicePtr = ChoicePtr + 1
  361.          ModifyMenuChoice (Select)
  362.          If Select < 'N'
  363.             GotoXY(6, (Ord(Select) - 64))
  364.             Write(spc)
  365.             GotoXY(6, (Ord(Select) - 64))
  366.          else
  367.             GotoXY(41, (Ord(Select) - 77))
  368.             Write(spc)
  369.             GotoXY(41, (Ord(Select) - 77))
  370.          endif
  371.          Write(Right(Menu[(Ord(Select) - 64)].Description, (Length(Menu[(Ord(Select) - 64)].Description) - 5)))
  372.       endif
  373.       if Select = F4
  374.          if EnterPassWord(UtilPassWord, 19)
  375.             EditUtilities
  376.           endif
  377.       endif
  378.    Until Select = ESC
  379.  
  380.    UpDate
  381.  
  382.    EraseTopWindow
  383.    EraseTopWindow
  384.    UseArrows On
  385.  
  386. EndProc ;Edit
  387.  
  388. ;---
  389.  
  390. Procedure Format
  391. Var Select
  392.  
  393.    MakeBox( 'Format Floppy Disk Menu', 0, 10, 44, 6, Util)
  394.    Writeln '  1 - Format 360      5 - Format /S 360'
  395.    Writeln '  2 - Format 1.2M     6 - Format /S 1.2M'
  396.    Writeln '  3 - Format 720      7 - Format /S 720'
  397.    Write   '  4 - Format 1.4M     8 - Format /S 1.4M'
  398.  
  399.    Repeat
  400.       Select = GetKey
  401.       if Select = '1' then Format2('/4')
  402.       if Select = '2' then Format2('')
  403.       if Select = '3' then Format2('/N:9/T:80')
  404.       if Select = '4' then Format2('/N:18/T:80')
  405.       if Select = '5' then Format2('/4/S')
  406.       if Select = '6' then Format2('/S')
  407.       if Select = '7' then Format2('/N:9/T:80/S')
  408.       if Select = '8' then Format2('/N:18/T:80/S')
  409.       if Select = F1 then Help
  410.    Until Select = ESC
  411.  
  412.    EraseTopWindow
  413.  
  414. EndProc ;Format
  415.  
  416. ;---
  417.  
  418. Procedure Main
  419. Var
  420.    Select
  421.  
  422.    MMActive = True
  423.    %ThisDirectory = Path
  424.    BlankMessage     'Running Level 1 Menu'
  425.    BlankTime      = 0
  426.    UseCommand On
  427.    NoExit
  428.    SavePosition On
  429.    FileSaved      = True
  430.  
  431.    UseArrows
  432.  
  433.    Repeat
  434.       Select = GetKey
  435.       if (Select >= 'A') and (Select <= 'Z')
  436.          Index = (Ord(Select) - 64)
  437.          if Menu[Index].Inuse
  438.             Trim(Menu[Index].Name)
  439.             if Menu[Index].Name > ''
  440.                BuildBat (Index)
  441.             else
  442.                Error('You have not selected a program for this menu choice!!')
  443.             endif
  444.          endif
  445.       endif
  446.       if Select = F10
  447.          EraseTopWindow
  448.          MMActive = False
  449.          Edit
  450.          UpdateScreen
  451.          MMActive = True
  452.       endif
  453.       if Select = F3
  454.          if EnterPassWord (DosUtilPassWord, 19)
  455.             MMActive = False
  456.             DosUtilities
  457.             MMActive = True
  458.             EraseTopWindow
  459.             Draw
  460.          endif
  461.       endif
  462.       if Select = F4
  463.          if EnterPassWord (UtilPassWord, 19)
  464.             MMActive = False
  465.             EditUtilities
  466.             UpDateScreen
  467.             MMActive = True
  468.          endif
  469.       endif
  470.       if Select = (Char(0) + Char(31)) ;SetUp
  471.          Setup
  472.       EndIf
  473.       if Select = ESC then Leave
  474.    Until Select = alt0
  475.  
  476. EndProc ;MainMenu
  477.  
  478. ;---
  479.  
  480. Procedure MenuBorderStyle (WinNum)
  481. Var
  482.    Select
  483.  
  484.    FileSaved = False
  485.  
  486.    MakeBox( 'Menu Border Style', 0, 0, 30, 5, Util)
  487.    Writeln("  A - Single Line Border " + Char(196))
  488.    Writeln("  B - Double Line Border " + Char(205))
  489.    Write  ("  C - Block Box Border   " + Char(219))
  490.  
  491.    Select = GetKey
  492.    While Select <> ESC
  493.       if Select = 'A'
  494.          if WinNum = MMenu then BorderStyle = Single
  495.          if WinNum = Util  then UtilBorderStyle = Single
  496.          if WinNum = Title then TitleBorderStyle = Single
  497.          EraseTopWindow
  498.          Return
  499.       endif
  500.       if Select = 'B'
  501.          if WinNum = MMenu then BorderStyle = Double
  502.          if WinNum = Util  then UtilBorderStyle = Double
  503.          if WinNum = Title then TitleBorderStyle = Double
  504.          EraseTopWindow
  505.          Return
  506.       endif
  507.       if Select = 'C'
  508.          if WinNum = MMenu then BorderStyle = Block
  509.          if WinNum = Util then UtilBorderStyle = Block
  510.          if WinNum = Title then TitleBorderStyle = Block
  511.          EraseTopWindow
  512.          Return
  513.       endif
  514.       if Select = F1 then Help
  515.       Select = GetKey
  516.    EndWhile
  517.  
  518.    EraseTopWindow
  519.  
  520. EndProc ;MenuBorderStyle
  521.  
  522. ;---
  523.  
  524. Procedure BackDrop
  525. Var
  526.    Select
  527.  
  528.    FileSaved = False
  529.  
  530.    MakeBox( '', 37, 10, 15, 7, Util)
  531.    Writeln("  A - " + Char(176))
  532.    Writeln("  B - " + Char(177))
  533.    Writeln("  C - " + Char(178))
  534.    Writeln("  D - " + Char(185))
  535.    Write  ("  E - Blank")
  536.  
  537.    Select = GetKey
  538.    While Select <> ESC
  539.       if Select = 'A'
  540.          BackDropCharacter = 176
  541.          EraseTopWindow
  542.          Return
  543.       endif
  544.       if Select = 'B'
  545.          BackDropCharacter = 177
  546.          EraseTopWindow
  547.          Return
  548.       endif
  549.       if Select = 'C'
  550.          BackDropCharacter = 178
  551.          EraseTopWindow
  552.          Return
  553.       endif
  554.       if Select = 'D'
  555.          BackDropCharacter = 185
  556.          EraseTopWindow
  557.          Return
  558.       endif
  559.       if Select = 'E'
  560.          BackDropCharacter = 32
  561.          EraseTopWindow
  562.       endif
  563.       if Select = F1 then Help
  564.       Select = GetKey
  565.    EndWhile
  566.  
  567.    EraseTopWindow
  568.  
  569. EndProc ;MenuBorderStyle
  570.  
  571. ;---
  572.  
  573. Procedure WhichWindow
  574. Var Select, RC = 0
  575.  
  576.    MakeBox( '', 47, 8, 27, 6, Util)
  577.    Writeln( "  A - Main Menu Window" )
  578.    Writeln( "  B - Title Window" )
  579.    Writeln( "  C - Utility Window" )
  580.    Write  ( "  D - Global Settings" )
  581.    Repeat
  582.       Select = GetKey
  583.       if Select = 'A' Then RC = MMenu
  584.       if Select = 'B' Then RC = Title
  585.       if Select = 'C' Then RC = Util
  586.       if Select = 'D' Then RC = 99
  587.    Until ((Select = Esc) or (Rc > 0))
  588.    EraseTopWindow
  589.    Return RC
  590.  
  591. EndProc  ;WhichWin
  592.  
  593. ;---
  594.  
  595. Procedure Global
  596. Var Select
  597.  
  598.    MakeBox( 'Global', 47, 8, 30, 7, Util)
  599.    Writeln("  A - Menu Title")
  600.    Writeln("  B - Menu Header")
  601.    Writeln("  C - Bottom of screen text")
  602.    Writeln("  D - BackDrop Character")
  603.    Write  ("  E - BackDrop Color")
  604.  
  605.    Repeat
  606.       Select = GetKey
  607.       FileSaved = False
  608.       if Select = 'A'
  609.          MenuTitle = ReadTextLine('Menu Title', MenuTitle, 60, 11)
  610.          if Not (MenuTitle > '') then MenuTitle = 'Your Name Here'
  611.          Trim(MenuTitle)
  612.       endif
  613.       if Select = 'B' then MenuHeader = ReadTextLine('Menu Header', MenuHeader, 30, 11)
  614.       if Select = 'C'
  615.          BottomOfScreenText = ReadTextLine('Bottom of screen text', BottomOfScreenText, 60, 11)
  616.          if Not (BottomOfScreenText > '') Then BottomOfScreenText = CopyrightMsg
  617.       endif
  618.       if Select = 'D' then BackDrop
  619.       if Select = 'E' then ChooseColors (MainScreenForeColor, MainScreenBackColor, 5)
  620.    Until Select = Esc
  621.    EraseTopWindow
  622.  
  623. EndProc ;Global
  624.  
  625. ;---
  626.  
  627. Procedure Setup
  628. Var Select CurrWin TmpBool
  629.  
  630.    CurrWin = WhichWindow
  631.    if CurrWin = 99
  632.       Global
  633.       Return
  634.    EndIf
  635.    MakeBox( 'Setup', 47, 8, 29, 7, Util)
  636.    Writeln("  A - Colors")
  637.    Writeln("  B - Menu Border Style")
  638.    Writeln("  C - Exploding Windows")
  639.    Writeln("  D - Shadows")
  640.    Write  ("  E - Sound")
  641.  
  642.    Repeat
  643.       Select = GetKey
  644.       FileSaved = False
  645.       if Select = 'A' then Colors (CurrWin)
  646.       if Select = 'B' then MenuBorderStyle (CurrWin)
  647.       if Select = 'C'
  648.          TmpBool = AskYesNo('Use exploding windows ?', 0)
  649.          if CurrWin = MMenu then ExplodeStatus = TmpBool
  650.          if CurrWin = Util  then UtilExplodeStatus = TmpBool
  651.          if CurrWin = Title then TitleExplodeStatus = TmpBool
  652.       endif
  653.       if Select = 'D'
  654.          TmpBool =  AskYesNo('Use window shadowing ?', 0)
  655.          if CurrWin = MMenu then ShadowStatus = TmpBool
  656.          if CurrWin = Util  then UtilShadowStatus = TmpBool
  657.          if CurrWin = Title then TitleShadowStatus = TmpBool
  658.       endif
  659.       if Select = 'E'
  660.          TmpBool = AskYesNo('Use sound effects ?', 0)
  661.          if CurrWin = MMenu then SoundStatus = TmpBool
  662.          if CurrWin = Util  then UtilSoundStatus = TmpBool
  663.          if CurrWin = Title then TitleSoundStatus = Tmpbool
  664.       endif
  665.    Until Select = Esc
  666.    EraseTopWindow
  667.  
  668. EndProc ;Setup
  669.  
  670. ;---
  671.  
  672. Procedure EditUtilities
  673. Var
  674.    Select
  675.  
  676.    MakeBox( 'Utilities', 6, 8, 36, 11, Util)
  677.  
  678.    Writeln("  A - ReScan Subdirectories")
  679.    Writeln("  B - Password to edit menu")
  680.    Writeln("  C - Password to exit to DOS")
  681.    Writeln("  D - Password for DOS Utilities")
  682.    Writeln("  E - Password for Utilites")
  683.    Writeln("  F - View current setup")
  684.    Writeln("  G - Batch File Editor")
  685.    Writeln("  H - Main Screen Setup")
  686.    Write  ("  I - Save Changes")
  687.  
  688.  
  689.    UseArrows On
  690.  
  691.    Select = GetKey
  692.    While Select <> ESC
  693.       If Select = 'A' then ScanDirectories
  694.       if Select = 'B'
  695.          FileSaved = False
  696.          ModifyPassWord = ReadTextLine('PassWord to edit menu', ModifyPassWord, 29, 10)
  697.       endif
  698.       if Select = 'C'
  699.          FileSaved = False
  700.          ExitToDosPassWord = ReadTextLine('PassWord to Exit to DOS',ExitToDosPassWord, 31, 10)
  701.       endif
  702.       if Select = 'D'
  703.          FileSaved = False
  704.          DosUtilPassWord = ReadTextLine('PassWord for Dos Utilities', DosUtilPassWord, 32, 10)
  705.       endif
  706.       if Select = 'E'
  707.          FileSaved = False
  708.          UtilPassWord = ReadTextLine('Password for Utilities', UtilPassWord, 30, 10)
  709.       endif
  710.       if Select = 'F' then ViewCurrentStatus
  711.       if Select = 'G' then BatEditor = ReadTextLine('Bat file Editor', BatEditor, 23, 10)
  712.       if Select = 'H' then Setup
  713.       if Select = 'I' then SaveChanges
  714.       if Select = F1 then Help
  715.       Select = GetKey
  716.    EndWhile
  717.  
  718.    EraseTopWindow
  719.  
  720. EndProc ;EditUtilities
  721.  
  722. ;---
  723.  
  724. { END MENUS }
  725.  
  726.  
  727. { File I/O                }
  728. { Save and Load Menu Data }
  729.  
  730. Procedure LoadData
  731.  
  732.    FileAssign(In, MenuName)
  733.    FileOpen(In)
  734.  
  735.    VerNo                 = FileReadln(In)
  736.    LongestItem           = Value(FileReadln(In))
  737.    Width                 = Value(FileReadln(In))
  738.    Height                = Value(FileReadln(In))
  739.    MenuTitle             = FileReadln(In)
  740.    ModifyPassWord        = FileReadln(In)
  741.    ExitToDosPassWord     = FileReadln(In)
  742.    ChoicePtr             = Value(FileReadln(In))
  743.    MenuHeader            = FileReadln(In)
  744.    BottomOfScreenText    = FileReadln(In)
  745.    BorderStyle           = Value(FileReadln(In))
  746.    UtilBorderStyle       = Value(FileReadln(In))
  747.    TitleBorderStyle      = Value(FileReadln(In))
  748.    MenuForeColor         = Value(FileReadln(In))
  749.    MenuBackColor         = Value(FileReadln(In))
  750.    MenuBorderForeColor   = Value(FileReadln(In))
  751.    MenuBorderBackColor   = Value(FileReadln(In))
  752.    MenuInverseForeColor  = Value(FileReadln(In))
  753.    MenuInverseBackColor  = Value(FileReadln(In))
  754.    MenuHeaderForeColor   = Value(FileReadln(In))
  755.    MenuHeaderBackColor   = Value(FileReadln(In))
  756.    MainScreenForeColor   = Value(FileReadln(In))
  757.    MainScreenBackColor   = Value(FileReadln(In))
  758.    UtilForeColor         = Value(FileReadln(In))
  759.    UtilBackColor         = Value(FileReadln(In))
  760.    UtilHeaderForeColor   = Value(FileReadln(In))
  761.    UtilHeaderBackColor   = Value(FileReadln(In))
  762.    UtilBorderForeColor   = Value(FileReadln(In))
  763.    UtilBorderBackColor   = Value(FileReadln(In))
  764.    UtilInverseForeColor  = Value(FileReadln(In))
  765.    UtilInverseBackColor  = Value(FileReadln(In))
  766.    TitleForeColor        = Value(FileReadln(In))
  767.    TitleBackColor        = Value(FileReadln(In))
  768.    TitleHeaderForeColor  = Value(FileReadln(In))
  769.    TitleHeaderBackColor  = Value(FileReadln(In))
  770.    TitleBorderForeColor  = Value(FileReadln(In))
  771.    TitleBorderBackColor  = Value(FileReadln(In))
  772.    TitleInverseForeColor = Value(FileReadln(In))
  773.    TitleInverseBackColor = Value(FileReadln(In))
  774.    TitleRow              = Value(FileReadln(In))
  775.    MsgRow                = Value(FileReadln(In))
  776.    ExplodeStatus         = FileReadln(In) = "TRUE"
  777.    ShadowStatus          = FileReadln(In) = "TRUE"
  778.    SoundStatus           = FileReadln(In) = "TRUE"
  779.    UtilExplodeStatus     = FileReadln(In) = "TRUE"
  780.    UtilShadowStatus      = FileReadln(In) = "TRUE"
  781.    UtilSoundStatus       = FileReadln(In) = "TRUE"
  782.    TitleExplodeStatus    = FileReadln(In) = "TRUE"
  783.    TitleShadowStatus     = FileReadln(In) = "TRUE"
  784.    TitleSoundStatus      = FileReadln(In) = "TRUE"
  785.  
  786.    i = 1
  787.    While i <= ChoicePtr
  788.       TmpSt = FileReadln(In)
  789.       Index = Ord(Mid(TmpSt, 2, 1)) - 64
  790.  
  791.       ScreenArr[i] = TmpSt
  792.  
  793.       Menu[Index].Description = TmpSt
  794.       Menu[Index].InUse       = TRUE
  795.       Menu[Index].Path        = FileReadln(In)
  796.       Menu[Index].name        = FileReadln(In)
  797.       Menu[Index].PassWord    = FileReadln(In)
  798.       Trim(Menu[Index].PassWord)
  799.       Menu[Index].Parameters  = FileReadln(In)
  800.       Menu[Index].Pause       = FileReadln(In) = "TRUE"
  801.  
  802.       i = i + 1
  803.    EndWhile
  804.  
  805.    BatEditor         = FileReadln(In)
  806.    DosUtilPassWord   = FileReadln(In)
  807.    UtilPassWord      = FileReadLn(In)
  808.    BackDropCharacter = Value(FileReadLn(In))
  809.  
  810.   FileClose(In)
  811.  
  812. EndProc ;LoadData
  813.  
  814. ;---
  815.  
  816. Procedure SaveChanges
  817. Var tmparr, i, x, Out
  818.  
  819.    FileSaved = TRUE
  820.    UseArrows Off
  821.  
  822.    MessageBox('', 'Saving...', 0, 0)
  823.  
  824.    ReadTextFile(MenuName, tmparr)
  825.  
  826.    UpDate
  827.  
  828.    FileAssign(Out, MenuName)
  829.    FileCreate(Out)
  830.  
  831.    FileWriteln(Out, VerNo)
  832.    FileWriteln(Out, Str(LongestItem))
  833.    FileWriteln(Out, Str(Width))
  834.    FileWriteln(Out, Str(Height))
  835.    FileWriteln(Out, MenuTitle)
  836.    FileWriteln(Out, ModifyPassWord)
  837.    FileWriteln(Out, ExitToDosPassWord)
  838.    FileWriteln(Out, Str(ChoicePtr))
  839.    FileWriteln(Out, MenuHeader)
  840.    FileWriteln(Out, BottomOfScreenText)
  841.    FileWriteln(Out, Str(BorderStyle))
  842.    FileWriteln(Out, Str(UtilBorderStyle))
  843.    FileWriteln(Out, Str(TitleBorderStyle))
  844.    FileWriteln(Out, Str(MenuForeColor))
  845.    FileWriteln(Out, Str(MenuBackColor))
  846.    FileWriteln(Out, Str(MenuBorderForeColor))
  847.    FileWriteln(Out, Str(MenuBorderBackColor))
  848.    FileWriteln(Out, Str(MenuInverseForeColor))
  849.    FileWriteln(Out, Str(MenuInverseBackColor))
  850.    FileWriteln(Out, Str(MenuHeaderForeColor))
  851.    FileWriteln(Out, Str(MenuHeaderBackColor))
  852.    FileWriteln(Out, Str(MainScreenForeColor))
  853.    FileWriteln(Out, Str(MainScreenBackColor))
  854.    FileWriteln(Out, Str(UtilForeColor))
  855.    FileWriteln(Out, Str(UtilBackColor))
  856.    FileWriteln(Out, Str(UtilHeaderForeColor))
  857.    FileWriteln(Out, Str(UtilHeaderBackColor))
  858.    FileWriteln(Out, Str(UtilBorderForeColor))
  859.    FileWriteln(Out, Str(UtilBorderBackColor))
  860.    FileWriteln(Out, Str(UtilInverseForeColor))
  861.    FileWriteln(Out, Str(UtilInverseBackColor))
  862.    FileWriteln(Out, Str(TitleForeColor))
  863.    FileWriteln(Out, Str(TitleBackColor))
  864.    FileWriteln(Out, Str(TitleHeaderForeColor))
  865.    FileWriteln(Out, Str(TitleHeaderBackColor))
  866.    FileWriteln(Out, Str(TitleBorderForeColor))
  867.    FileWriteln(Out, Str(TitleBorderBackColor))
  868.    FileWriteln(Out, Str(TitleInverseForeColor))
  869.    FileWriteln(Out, Str(TitleInverseBackColor))
  870.    FileWriteln(Out, Str(TitleRow))
  871.    FileWriteln(Out, Str(MsgRow))
  872.  
  873.    if ExplodeStatus
  874.       FileWriteln(Out, 'TRUE')
  875.    else
  876.       FileWriteln(Out, 'FALSE')
  877.    endif
  878.  
  879.    if ShadowStatus
  880.       FileWriteln(Out, "TRUE")
  881.    else
  882.       FileWriteln(Out, "FALSE")
  883.    endif
  884.  
  885.    if SoundStatus
  886.       FileWriteln(Out, "TRUE")
  887.    else
  888.       FileWriteln(Out, "FALSE")
  889.    endif
  890.  
  891.    if UtilExplodeStatus
  892.       FileWriteln(Out, 'TRUE')
  893.    else
  894.       FileWriteln(Out, 'FALSE')
  895.    endif
  896.  
  897.    if UtilShadowStatus
  898.       FileWriteln(Out, "TRUE")
  899.    else
  900.       FileWriteln(Out, "FALSE")
  901.    endif
  902.  
  903.    if UtilSoundStatus
  904.       FileWriteln(Out, "TRUE")
  905.    else
  906.       FileWriteln(Out, "FALSE")
  907.    endif
  908.  
  909.    if TitleExplodeStatus
  910.       FileWriteln(Out, 'TRUE')
  911.    else
  912.       FileWriteln(Out, 'FALSE')
  913.    endif
  914.  
  915.    if TitleShadowStatus
  916.       FileWriteln(Out, "TRUE")
  917.    else
  918.       FileWriteln(Out, "FALSE")
  919.    endif
  920.  
  921.    if TitleSoundStatus
  922.       FileWriteln(Out, "TRUE")
  923.    else
  924.       FileWriteln(Out, "FALSE")
  925.    endif
  926.  
  927.    i = 1
  928.    While i <= 27
  929.       if Menu[i].Inuse
  930.          FileWriteln(Out, Menu[I].Description)
  931.          FileWriteln(Out, Menu[I].Path)
  932.          FileWriteln(Out, Menu[I].name)
  933.          FileWriteln(Out, Menu[I].PassWord)
  934.          FileWriteln(Out, Menu[I].Parameters)
  935.          if Menu[I].Pause
  936.             FileWriteln(Out, 'TRUE')
  937.          else
  938.             FileWriteln(Out, 'FALSE')
  939.          endif
  940.       endif
  941.       i = i + 1
  942.    EndWhile
  943.  
  944.    FileWriteln(Out, BatEditor)
  945.    FileWriteln(Out, DosUtilPassWord)
  946.    FileWriteln(Out, UtilPassWord)
  947.    FileWriteln(Out, Str(BackDropCharacter))
  948.  
  949.    FileClose(Out)
  950.  
  951.    EraseTopWindow
  952.  
  953.    UseArrows On
  954.  
  955. EndProc ;SaveChanges
  956.  
  957. ;---
  958.  
  959.  
  960. { END of FILE I/O }
  961.  
  962.  
  963.  
  964. { Utilities }
  965.  
  966. Procedure Abort ( ErrMsg )
  967.  
  968.   ClearScreen
  969.   ClearScreenOnExit Off
  970.   WriteLn("Error :")
  971.   Writeln( ErrMsg )
  972.   ExitMenu
  973.  
  974. EndProc ;Abort
  975.  
  976. ;---
  977.  
  978. Procedure AskYesNo (Question, Row)
  979. var YesNo
  980.  
  981.    MakeBox( '',(34 - (Length(Question) / 2)), Row, Length(Question) + 14, 3)
  982.    UseArrows Off
  983.    Write ' ',Question,' (Y/N) '
  984.    YesNo = GetKey
  985.    YesNo = YesNo = 'Y'
  986.    if YesNo
  987.       Write 'Yes'
  988.    else
  989.       Write 'No'
  990.    endif
  991.    Wait 50
  992.    EraseTopWindow
  993.    UseArrows On
  994.    Return YesNo
  995.  
  996. EndProc ;AskYesNo
  997.  
  998. ;---
  999.  
  1000. Procedure ChooseColors (OrigX, OrigY, VType)
  1001. Var X Y Ch
  1002.  
  1003.    UseArrows Off
  1004.    MakeBox( 'Pick Color', 13 , 13, 20, 12)
  1005.    Y = 0
  1006.    While Y < 8
  1007.       X = 0
  1008.       While X < 16
  1009.          if (X = OrigX) and (Y = OrigY)
  1010.             Ch = 254
  1011.          else
  1012.             Ch = 4
  1013.          endif
  1014.  
  1015.          WriteColor(Ch, X, Y)
  1016.  
  1017.          X = X + 1
  1018.       EndWhile
  1019.       Y = Y + 1
  1020.    EndWhile
  1021.  
  1022.    X = OrigX
  1023.    Y = OrigY
  1024.  
  1025.    repeat
  1026.      ; WriteColor(15,X,Y)
  1027.       GotoXY(X + 2, Y + 2)
  1028.       Ch = GetKey
  1029.  
  1030.       if (X = OrigX) and (Y = OrigY)
  1031.          WriteColor(254,X,Y)
  1032.       else
  1033.          WriteColor(4,X,Y)
  1034.       endif
  1035.  
  1036.       if Ch = Char(Larr) then X = ((X + 15) mod 16)
  1037.       if Ch = Char(Rarr) then X = ((X + 1)  mod 16)
  1038.       if Ch = Char(Uarr) then Y = ((Y + 7)  mod 8)
  1039.       if Ch = Char(Darr) then Y = ((Y + 1)  mod 8)
  1040.  
  1041.       if Ch = Esc
  1042.          X = OrigX
  1043.          Y = OrigY
  1044.       endif
  1045.  
  1046.    until ((Ch = Esc) or (Ch = Char(13)))
  1047.    EraseTopWindow
  1048.  
  1049.    if VType = 1
  1050.       MenuForeColor = X
  1051.       MenuBackColor = Y
  1052.    endif
  1053.    if VType = 2
  1054.       MenuBorderForeColor = X
  1055.       MenuBorderBackColor = Y
  1056.    endif
  1057.    if Vtype = 3
  1058.       MenuInverseForeColor = X
  1059.       MenuInverseBackColor = Y
  1060.    endif
  1061.    if Vtype = 4
  1062.       MenuHeaderForeColor = X
  1063.       MenuHeaderBackColor = Y
  1064.    endif
  1065.    if Vtype = 5
  1066.       MainScreenForeColor = X
  1067.       MainScreenBackColor = Y
  1068.    endif
  1069.    if Vtype = 6
  1070.       ClockForeColor = X
  1071.       ClockBackColor = Y
  1072.    endif
  1073.    if Vtype = 9
  1074.       UtilForeColor = X
  1075.       UtilBackColor = Y
  1076.    endif
  1077.    if Vtype = 10
  1078.       UtilBorderForeColor = X
  1079.       UtilBorderBackColor = Y
  1080.    endif
  1081.    if Vtype = 11
  1082.       UtilInverseForeColor = X
  1083.       UtilInverseBackColor = Y
  1084.    endif
  1085.    if Vtype = 12
  1086.       UtilHeaderForeColor = X
  1087.       UtilHeaderBackColor = Y
  1088.    endif
  1089.    if Vtype = 13
  1090.       TitleForeColor = X
  1091.       TitleBackColor = Y
  1092.    endif
  1093.    if Vtype = 14
  1094.       TitleBorderForeColor = X
  1095.       TitleBorderBackColor = Y
  1096.    endif
  1097.    if Vtype = 15
  1098.       TitleInverseForeColor = X
  1099.       TitleInverseBackColor = Y
  1100.    endif
  1101.    if Vtype = 16
  1102.       TitleHeaderForeColor = X
  1103.       TitleHeaderBackColor = Y
  1104.    endif
  1105.  
  1106.    UseArrows On
  1107.  
  1108. EndProc ;ChooseColors
  1109.  
  1110. ;---
  1111.  
  1112. Procedure ChooseDirectory
  1113. var BoxDim SubChoice
  1114.  
  1115.    if TotalSubs > 1
  1116.       BoxDim[3] = Min(LongestSubLine + 6,ScreenWidth - 6)
  1117.       BoxDim[4] = Min(TotalSubs + 2,ScreenHeight - 6)
  1118.       BoxDim[1] = Max(Min(45,ScreenWidth - BoxDim[3]),1)
  1119.       BoxDim[2] = Max(Min(7,ScreenHeight - BoxDim[4]),4)
  1120.       MakeBox( '', BoxDim[1], BoxDim[2], BoxDim[3], BoxDim[4])
  1121.       SubChoice = PickOne Subs
  1122.       EraseTopWindow
  1123.    endif
  1124.    if TotalSubs = 1 then SubChoice = Subs[1]
  1125.    Return SubChoice
  1126.  
  1127. EndProc ;ChooseDirectory
  1128.  
  1129. ;---
  1130.  
  1131. Procedure ChooseProgram (SubDir)
  1132. var BoxDim Progs ProgChoice TotalProgs LongestProgLine
  1133.  
  1134.    MessageBox( '', 'Scanning Programs', 35, 18)
  1135.    ClearScreenFirst Off
  1136.    UseCommand On
  1137.    Execute 'D ' + SubDir + '/F/R/O > PROGS.PIC'
  1138.    ReadTextFile 'PROGS.PIC' Progs
  1139.    DelFile 'PROGS.PIC'
  1140.    TotalProgs = NumberOfElements(Progs)
  1141.    LongestProgLine = LongestLine
  1142.    EraseTopWindow
  1143.    if TotalProgs > 0
  1144.       BoxDim[3] = Min(LongestProgLine + 6,ScreenWidth - 6)
  1145.       BoxDim[4] = Min(TotalProgs + 2,ScreenHeight - 4)
  1146.       BoxDim[1] = Max(Min(45,ScreenWidth - BoxDim[3]),1)
  1147.       BoxDim[2] = Max(Min(7,ScreenHeight - BoxDim[4]),4)
  1148.       DrawBox BoxDim[1] BoxDim[2] BoxDim[3] BoxDim[4]
  1149.       ProgChoice = PickOne Progs
  1150.       EraseTopWindow
  1151.    endif
  1152.    Return ProgChoice
  1153.  
  1154. EndProc ;ChooseProgram
  1155.  
  1156. ;---
  1157.  
  1158. Procedure EditBat
  1159. Var %Exec
  1160.  
  1161.    ClearScreenOnExit On
  1162.    ClearScreenFirst  On
  1163.  
  1164.    {Check to See if user has already specified bat file }
  1165.    if Not (Right(Menu[Index].Name, 3) = "BAT")
  1166.       Menu[Index].Name = UpperCase(ReadTextLine('Enter BAT File Name', Menu[Index].Name, 50, 16))
  1167.    endif
  1168.  
  1169.    if LastKey <> Esc
  1170.       %Exec = BatEditor + " " + Menu[Index].Name
  1171.       Execute(%Exec)
  1172.    endif
  1173.  
  1174. EndProc ;EditBat
  1175.  
  1176. ;---
  1177.  
  1178. Procedure EnterPassWord (pass, row)
  1179. Var LY TX RY BX TmpSt
  1180.  
  1181.    Trim(Pass)
  1182.    if Not (Length(pass)  > 0) then Return true
  1183.  
  1184.    Security On
  1185.    if Length(pass) < 20
  1186.       RY = 21
  1187.    else
  1188.       RY = Length(pass) + 1
  1189.    endif
  1190.  
  1191.    TX = 6
  1192.    LY = 3
  1193.    BX = 3
  1194.  
  1195.    MakeBox( 'PassWord', LY, TX, RY, BX, Util)
  1196.    Write ' '
  1197.    TmpSt = Readln
  1198.  
  1199.    Security Off
  1200.  
  1201.    EraseTopWindow
  1202.  
  1203.    if TmpSt = pass
  1204.       Return True
  1205.    else
  1206.       Return False
  1207.    endif
  1208.  
  1209. EndProc ;EnterPassWord
  1210.  
  1211. ;---
  1212.  
  1213.  
  1214. Procedure Error (ErrMsg)
  1215.   BoxHeaderColor White Blue
  1216.   BoxBorderColor White Red
  1217.   BoxInsideColor White Red
  1218.   BoxHeader = " Error "
  1219.   DoubleLineBox
  1220.   DrawBox (80 - Length(ErrMsg) /2) 10 (Length(ErrMsg) + 4) 3
  1221.   WriteCenter (ErrMsg)
  1222.   Write(char(7))
  1223.   Wait(250)
  1224.   EraseTopWindow
  1225.   SingleLineBox
  1226. EndProc ;Error
  1227.  
  1228. ;---
  1229.  
  1230. Procedure MainColors
  1231.  
  1232.    Explode ExplodeStatus
  1233.    Sound   SoundStatus
  1234.    Shadow  ShadowStatus
  1235.  
  1236.    if BorderStyle = None   then NoBoxBorder
  1237.    if BorderStyle = Single then SingleLineBox
  1238.    if BorderStyle = Double then DoubleLineBox
  1239.    if BorderStyle = Block  then BlockBox
  1240.  
  1241.    InverseColor   MenuInverseForeColor MenuInverseBackColor
  1242.    BoxHeaderColor MenuHeaderForeColor  MenuHeaderBackColor
  1243.    BoxInsideColor MenuForeColor        MenuBackColor
  1244.    BoxBorderColor MenuBorderForeColor  MenuBorderBackColor
  1245.  
  1246. EndProc ;MainColors
  1247.  
  1248. ;---
  1249.  
  1250. Procedure UtilColors
  1251.  
  1252.    Explode UtilExplodeStatus
  1253.    Sound   UtilSoundStatus
  1254.    Shadow  UtilShadowStatus
  1255.  
  1256.    if UtilBorderStyle = None   then NoBoxBorder
  1257.    if UtilBorderStyle = Single then SingleLineBox
  1258.    if UtilBorderStyle = Double then DoubleLineBox
  1259.    if UtilBorderStyle = Block  then BlockBox
  1260.  
  1261.    InverseColor   UtilInverseForeColor UtilInverseBackColor
  1262.    BoxHeaderColor UtilHeaderForeColor  UtilHeaderBackColor
  1263.    BoxInsideColor UtilForeColor        UtilBackColor
  1264.    BoxBorderColor UtilBorderForeColor  UtilBorderBackColor
  1265.  
  1266. EndProc ;UtilColors
  1267.  
  1268. ;---
  1269.  
  1270. Procedure TitleColors
  1271.  
  1272.    Explode TitleExplodeStatus
  1273.    Sound   TitleSoundStatus
  1274.    Shadow  TitleShadowStatus
  1275.  
  1276.    if TitleBorderStyle = None   then NoBoxBorder
  1277.    if TitleBorderStyle = Single then SingleLineBox
  1278.    if TitleBorderStyle = Double then DoubleLineBox
  1279.    if TitleBorderStyle = Block  then BlockBox
  1280.  
  1281.    InverseColor   TitleInverseForeColor  TitleInverseBackColor
  1282.    BoxHeaderColor TitleHeaderForeColor   TitleHeaderBackColor
  1283.    BoxInsideColor TitleForeColor         TitleBackColor
  1284.    BoxBorderColor TitleBorderForeColor   TitleBorderBackColor
  1285.  
  1286. EndProc ;TitleColors
  1287.  
  1288. ;---
  1289.  
  1290. Procedure MakeBox(Header, Col, Row, Wid, Depth, ColorSet)
  1291.  
  1292.    {0 for Col will center box horizontaly}
  1293.    if Col = 0 then Col = (80 - (Wid - 2)) /2
  1294.    {0 for Row will center box vertically}
  1295.    if Row = 0 then Row = ((25 - Depth) /2) + 1
  1296.  
  1297.    if Header > '' then BoxHeader = Char(221) + ' ' + Header + ' ' + char(222)
  1298.  
  1299.    if ColorSet = MMenu
  1300.       MainColors
  1301.    else
  1302.       if ColorSet = Util
  1303.          UtilColors
  1304.       else
  1305.           if ColorSet = Title
  1306.              TitleColors
  1307.           endif
  1308.       endif
  1309.    endif
  1310.  
  1311.    DrawBox(Col, Row, Wid, Depth)
  1312.  
  1313. EndProc ;MakeBox
  1314.  
  1315. ;---
  1316.  
  1317. Procedure MessageBox(Header, Message, Col, Row)
  1318.  
  1319.    MakeBox(Header, Col, Row, (Length(Message) + 4), 3, Util)
  1320.    WriteCenter(Message)
  1321.  
  1322. EndProc ;MessageBox
  1323.  
  1324. ;---
  1325.  
  1326. Procedure ReadTextLine (Header, Suggestion, MaxAnswerLength, Row)
  1327. var St
  1328.  
  1329.    Trim(Header)
  1330.    MakeBox( Header, 0, Row, (MaxAnswerLength + 2), 3, Util)
  1331.    Write ' '
  1332.    InputString = Suggestion
  1333.    St = Readln
  1334.    EraseTopWindow
  1335.    if LastKey <> Char(13)
  1336.       Return Suggestion
  1337.    else
  1338.       Return St
  1339.    endif
  1340.  
  1341. EndProc ;ReadTextLine
  1342.  
  1343. ;---
  1344.  
  1345. Procedure RedrawSelections
  1346. Var x y
  1347.  
  1348.    MakeBox( 'Edit', 0, 6, 78, 15, Util)
  1349.    UseArrows On
  1350.  
  1351.    x = 1
  1352.    y = 1
  1353.    While x < 14
  1354.       GotoXY(1, y)
  1355.       if Menu[x].InUse
  1356.          Write(Menu[x].Description)
  1357.       else
  1358.          Write(" " , Char(x + 64) , " - ")
  1359.       endif
  1360.       GotoXY(37,y)
  1361.       if Menu[x + 13].InUse
  1362.          GotoXY(36,y)
  1363.          Write(Menu[x + 13].Description)
  1364.       else
  1365.          Write(Char(x + 77) , " - ")
  1366.       endif
  1367.       x = x + 1
  1368.       y = y + 1
  1369.    EndWhile
  1370.  
  1371. EndProc ;RedrawSelections
  1372.  
  1373. ;---
  1374.  
  1375. Procedure ScanDirectories
  1376.  
  1377.    MessageBox( '',  'Scanning Directories', 0, 0)
  1378.    ClearScreenFirst Off
  1379.    UseCommand On
  1380.    Execute (DirScanProg + '/T >' + SubListName)
  1381.    Dispose Subs
  1382.    ReadTextFile SubListName Subs
  1383.    TotalSubs = NumberOfElements(Subs)
  1384.    LongestSubLine = LongestLine
  1385.    EraseTopWindow
  1386.  
  1387. EndProc ; ScanDirectories
  1388.  
  1389. ;---
  1390.  
  1391. Procedure Update
  1392.  
  1393.    ChoicePtr = 0
  1394.    LongestItem = 0
  1395.    I = 1
  1396.    While I < 27
  1397.       if Menu[I].InUse
  1398.          ChoicePtr = ChoicePtr + 1
  1399.          if Length(Menu[I].Description) > LongestItem
  1400.             LongestItem = Length(Menu[I].Description)
  1401.          endif
  1402.          ScreenArr[ChoicePtr] = Menu[I].Description
  1403.       endif
  1404.       I = I + 1
  1405.    EndWhile
  1406.  
  1407.    if ChoicePtr < 10
  1408.       Height = ChoicePtr + 2
  1409.       Width  = LongestItem + 4
  1410.    else
  1411.       Height = (((ChoicePtr / 2) + (ChoicePtr Mod 2)) + 2)
  1412.       Width  = (LongestItem * 2) + 7
  1413.    endif
  1414.    TitleRow = (((25 - Height) / 2) - 3)
  1415.    MsgRow = ((TitleRow + 5) + Height)
  1416.  
  1417. EndProc ;Update
  1418.  
  1419. ;---
  1420.  
  1421. Procedure WriteColor (Ch, X, Y)
  1422.  
  1423.    TextColor(X, Y)
  1424.    GotoXY(X + 2, Y + 2)
  1425.    Write(Char(Ch))
  1426.  
  1427. EndProc ;WriteColor
  1428.  
  1429. ;---
  1430.  
  1431. Procedure WriteStatus (Msg, Row)
  1432.  
  1433.    GotoXY(1, Row)
  1434.    Write(Msg)
  1435.    GotoXY(67, Row)
  1436.    Write("]")
  1437.  
  1438. EndProc ;WriteStatus
  1439.  
  1440. ;---
  1441.  
  1442. { ENd of Utilites }
  1443.  
  1444.  
  1445.  
  1446. { Support Routines }
  1447.  
  1448. Procedure BuildBat (Num)
  1449. Var
  1450.    B, I, Ptr, FP
  1451.  
  1452.    if Not FileSaved
  1453.       If AskYesNo("Menu not saved! Save Changes?", 0) then SaveChanges
  1454.    endif
  1455.  
  1456.    if EnterPassWord (Menu[Num].PassWord, 19)
  1457.       if left(Menu[Num].Name,1) = '^'
  1458.          ClearScreenFirst Off
  1459.          ClearScreenOnExit Off
  1460.          B = 'SET MENU=' + Right(Menu[Num].Name, Length(Menu[Num].Name) - 1)
  1461.          Bat(B)
  1462.          Bat('MARX LEVEL2')
  1463.          Exitmenu
  1464.       endif
  1465.       ChDir(Menu[Num].Path)
  1466.       B = Menu[Num].Name + " " + Menu[Num].Parameters
  1467.       Bat(B)
  1468.       if Menu[Num].Pause Then Bat("Pause")
  1469.       B = %ThisDrive
  1470.       Bat(B)
  1471.       B = "CD " + %ThisDirectory
  1472.       Bat(B)
  1473.       ExitMenu
  1474.    EndIf
  1475.  
  1476. EndProc ;BuildBat
  1477.  
  1478. ;---
  1479.  
  1480. Procedure DrawTop
  1481.  
  1482.    ClockPos 0, 0
  1483.  
  1484.    TextColor MainScreenForeColor MainScreenBackColor
  1485.    if ColorScreen
  1486.       ClearScreen BackDropCharacter
  1487.    else
  1488.       ClearScreen BackDropCharacter
  1489.    endif
  1490.    TextColor UtilForeColor UtilBackColor
  1491.  
  1492.    MakeBox( '', 1, 1, 80, 4, Title)
  1493.    ClockColor TitleForeColor TitleBackColor
  1494.    ClockPos 3, 2
  1495.    GotoXY 53, 1
  1496.    Write(ProgramName, Version)
  1497.    Writeln
  1498.    WriteCenter(MenuTitle)
  1499.  
  1500. EndProc ;DrawTop
  1501.  
  1502. ;---
  1503.  
  1504. Procedure DrawBottom (s)
  1505.  
  1506.    MakeBox( '', 1, 22, 80, 4, Title)
  1507.    WriteCenter(s)
  1508.    Writeln
  1509.    WriteCenter BottomOfScreenText
  1510.  
  1511. EndProc ;DrawBottom
  1512.  
  1513. ;---
  1514.  
  1515. Procedure Draw
  1516. Var
  1517.    I, X
  1518.  
  1519.    MainColors
  1520.  
  1521.    MakeBox( MenuHeader, 0, 0, Width, Height, MMenu)
  1522.  
  1523.    if ChoicePtr < 10
  1524.       I = 1
  1525.       While I < ChoicePtr
  1526.          Writeln(' ', ScreenArr[I])
  1527.          I = I +1
  1528.       EndWhile
  1529.       Write(' ', ScreenArr[I])
  1530.    else
  1531.       I = 1
  1532.       X = LongestItem + 2
  1533.  
  1534.       While I < (ChoicePtr / 2)
  1535.          Writeln(' ', ScreenArr[I], ' ')
  1536.          I = I + 1
  1537.       EndWhile
  1538.       Write(' ', ScreenArr[I], ' ')
  1539.  
  1540.       I = I + 1
  1541.       While I < ChoicePtr
  1542.          GotoXY(X, (I - (ChoicePtr / 2)))
  1543.          Write(' ', ScreenArr[I])
  1544.          I = I + 1
  1545.       EndWhile
  1546.  
  1547.  
  1548.       if ChoicePtr Mod 2 = 0
  1549.          GotoXY(X , (I - (ChoicePtr / 2)))
  1550.          Write(' ',ScreenArr[I])
  1551.       else
  1552.          GotoXY(X, Height - 2)
  1553.          WriteCenter(ScreenArr[I])
  1554.       endif
  1555.  
  1556.    endif
  1557.  
  1558.    UseArrows On
  1559.  
  1560. EndProc ;Draw
  1561.  
  1562. ;---
  1563.  
  1564. Procedure Help
  1565. Var Key
  1566.  
  1567.    UseArrows Off
  1568.    MakeBox( '* Help *', 5, 8, 70, 12, Util)
  1569.    if ExistFile('Help.Txt')
  1570.       ViewTextFile('Help.Txt')
  1571.    else
  1572.       Writeln
  1573.       WriteCenter('HELP.TXT not available!')
  1574.       Writeln
  1575.       Writeln
  1576.       WriteCenter('<*> Press any key to continue <*>')
  1577.  
  1578.       Key = GetKey
  1579.  
  1580.       EraseTopWindow
  1581.       if MMActive
  1582.          EraseTopWindow
  1583.          Draw
  1584.       EndIf
  1585.    endif
  1586.  
  1587.    UseArrows On
  1588.  
  1589. EndProc ;Help
  1590.  
  1591. ;---
  1592.  
  1593. Procedure InitilizeData
  1594.  
  1595.    VerNo                 = Version
  1596.    ChoicePtr             = 0
  1597.    Width                 = 25
  1598.    Height                = 3
  1599.    ExplodeStatus         = False
  1600.    ShadowStatus          = False
  1601.    SoundStatus           = False
  1602.    TitleExplodeStatus    = False
  1603.    TitleShadowStatus     = False
  1604.    TitleSoundStatus      = False
  1605.    UtilExplodeStatus     = False
  1606.    UtilShadowStatus      = False
  1607.    UtilSoundStatus       = False
  1608.    BorderStyle           = Block
  1609.    TitleBorderStyle      = Block
  1610.    UtilBorderStyle       = Block
  1611.    BottomOfScreenText    = CopyRightMsg
  1612.    MenuHeader            = ''
  1613.    MenuTitle             = 'Your Company Title Here'
  1614.    ModifyPassWord        = ''
  1615.    ExitToDosPassWord     = ''
  1616.    DosUtilPassWord       = ''
  1617.    UtilPassWord          = ''
  1618.    BorderStyle           = Double
  1619.    MenuForeColor         = Cyan
  1620.    MenuBackColor         = Blue
  1621.    MenuBorderForeColor   = Cyan
  1622.    MenuBorderBackColor   = Blue
  1623.    MenuInverseForeColor  = Yellow
  1624.    MenuInverseBackColor  = Red
  1625.    MenuHeaderForeColor   = White
  1626.    MenuHeaderBackColor   = Mag
  1627.    MainScreenForeColor   = Red
  1628.    MainScreenBackColor   = Blue
  1629.    UtilForeColor         = Yellow
  1630.    UtilBackColor         = Brown
  1631.    UtilBorderForeColor   = LRed
  1632.    UtilBorderBackColor   = Brown
  1633.    UtilInverseForeColor  = Yellow
  1634.    UtilInverseBackColor  = Red
  1635.    UtilHeaderForeColor   = Yellow
  1636.    UtilHeaderBackColor   = Mag
  1637.    TitleForeColor        = Yellow
  1638.    TitleBackColor        = Brown
  1639.    TitleBorderForeColor  = Green
  1640.    TitleBorderBackColor  = Brown
  1641.    TitleInverseForeColor = Yellow
  1642.    TitleInverseBackColor = Red
  1643.    TitleHeaderForeColor  = White
  1644.    TitleHeaderBackColor  = Mag
  1645.    TitleRow              = 3
  1646.    MsgRow                = 20
  1647.    BatEditor             = 'me.exe'
  1648.    BackDropCharacter     = 178
  1649.    ConBlankTime          = 3
  1650.    ConLockWord           = ''
  1651.    ConBlankMessage       = "Running Level 1 Menu"
  1652.  
  1653. EndProc ;InitilizeData
  1654.  
  1655. ;---
  1656.  
  1657. Procedure Format2 (%Parm)
  1658. Var Select
  1659.  
  1660.    MakeBox( 'Drive', 55, 14, 11, 4, Util)
  1661.    Writeln '   A:'
  1662.    Write   '   B:'
  1663.  
  1664.    Select = GetKey
  1665.    while Select <> ESC
  1666.       if Select = 'A'
  1667.          Execute('FORMAT A: ' + %Parm)
  1668.          EraseTopWindow
  1669.          Return
  1670.       endif
  1671.       if Select = 'B'
  1672.          Execute('Format B: ' + %Parm)
  1673.          EraseTopWindow
  1674.          Return
  1675.       endif
  1676.       Select = GetKey
  1677.    EndWhile
  1678.  
  1679.    EraseTopWindow
  1680.  
  1681. EndProc ; Format
  1682.  
  1683. ;---
  1684.  
  1685. Procedure Leave
  1686.  
  1687.    if Not FileSaved
  1688.       If AskYesNo("Menu not saved! Save Changes?", 0)
  1689.          SaveChanges
  1690.       endif
  1691.    endif
  1692.  
  1693.    if ExitToDosPassWord > ''
  1694.       if EnterPassWord (ExitToDosPassWord, 19) then ExitMenu
  1695.    else
  1696.       if AskYesNo('Confirm exit to DOS?', 0) then ExitMenu
  1697.    endif
  1698.  
  1699. EndProc ;Leave
  1700.  
  1701. ;---
  1702.  
  1703. Procedure ModifyMenuChoice (choice)
  1704. Var Select NewChoice
  1705.  
  1706.    FileSaved = False
  1707.  
  1708.    index = ord(choice) - 64
  1709.    if Not Menu[index].InUse
  1710.       Menu[index].Description = ' '
  1711.       Menu[index].Path        = ' '
  1712.       Menu[index].Name        = ' '
  1713.       Menu[index].Password    = ' '
  1714.       Menu[index].Parameters  = ' '
  1715.       Menu[index].Pause       = False
  1716.    endif
  1717.  
  1718.    if Index < 14
  1719.       MakeBox( 'Edit Menu Item', 46, 8, 26, 6, Util)
  1720.    else
  1721.       MakeBox( 'Edit Menu Item', 9, 8, 26, 6, Util)
  1722.    endif
  1723.    Writeln("  A - Screen Text")
  1724.    Writeln("  B - Program")
  1725.    Writeln("  C - Delete choice")
  1726.    Write  ("  D - Advanced Options")
  1727.  
  1728.    UseArrows On
  1729.  
  1730.    Select = GetKey
  1731.    While Select <> ESC
  1732.       If Select = 'A'
  1733.          FileSaved = False
  1734.          if Not Menu[Index].Inuse
  1735.             NewChoice = True
  1736.          else
  1737.             NewChoice = False
  1738.          endif
  1739.          Menu[Index].Description = ReadTextLine('Screen Text', Right(Menu[Index].Description, (Length(Menu[Index].Description) - 5)), 30, 10)
  1740.          Trim(Menu[Index].Description)
  1741.          If (Length(Menu[Index].Description) > 0)
  1742.             Menu[Index].InUse = True
  1743.             Menu[Index].Description = " " + Char(Index + 64) + " - " + Menu[Index].Description
  1744.             if (Length(Menu[Index].Description) > LongestItem)
  1745.                LongestItem = Length(Menu[Index].Description)
  1746.             endif
  1747.             if NewChoice
  1748.                Menu[Index].Path = ChooseDirectory
  1749.                if Length(Menu[Index].Path)  > 0
  1750.                   Menu[Index].Name = ChooseProgram (Menu[Index].Path)
  1751.                endif
  1752.             endif
  1753.          else
  1754.             Menu[Index].InUse = False
  1755.          endif
  1756.       EndIf
  1757.       If Select = 'B'
  1758.          FileSaved = False
  1759.          Menu[Index].Path = ChooseDirectory
  1760.          if Length(Menu[Index].Path) > 0
  1761.             Menu[Index].Name = ChooseProgram (Menu[Index].Path)
  1762.          endif
  1763.       EndIf
  1764.       If Select = 'C'
  1765.          if AskYesNo('Are you sure?', 0)
  1766.             FileSaved = False
  1767.             Menu[Index].InUse = False
  1768.             Menu[index].Description = ' '
  1769.             Menu[index].Path        = ' '
  1770.             Menu[index].Name        = ' '
  1771.             Menu[index].Password    = ' '
  1772.             Menu[index].Parameters  = ' '
  1773.             Menu[index].Pause       = False
  1774.             EraseTopWindow
  1775.             Return
  1776.          endif
  1777.       EndIf
  1778.       If Select = 'D' then AdvancedOptions
  1779.       Select = GetKey
  1780.    EndWhile
  1781.  
  1782.    EraseTopWindow
  1783.  
  1784. EndProc ; Modify
  1785.  
  1786. ;---
  1787.  
  1788. Procedure NoChoices
  1789. Var Select
  1790.  
  1791.    FileSaved = False
  1792.  
  1793.    MakeBox( '', 0, 0, 50, 8, MMenu)
  1794.    WriteCenter('You have no menu choices available!')
  1795.    Writeln
  1796.    Writeln
  1797.    WriteCenter('Press F10 to setup your menu.')
  1798.    Writeln
  1799.    Writeln
  1800.    WriteCenter('Press ESC to exit to DOS.')
  1801.  
  1802.    UseArrows Off
  1803.    Select = ReadKey
  1804.  
  1805.    While (Select <> F10) or (Select <> ESC)
  1806.       if Select = F10
  1807.          EraseTopWindow
  1808.          Edit
  1809.          Return
  1810.       endif
  1811.       if Select = ESC then Exitmenu
  1812.       Select = ReadKey
  1813.    EndWhile
  1814.  
  1815.    EraseTopWindow
  1816.  
  1817. EndProc ;NoChoices
  1818.  
  1819. ;---
  1820.  
  1821. Procedure UpdateScreen
  1822.  
  1823.    EraseTopWindow
  1824.    EraseTopWindow
  1825.    EraseTopwindow
  1826.    DrawTop
  1827.    DrawBottom ('F1 - Help * ? - Mini Help')
  1828.    Draw
  1829.  
  1830. EndProc ;UpdateScreen
  1831.  
  1832. ;---
  1833.  
  1834. Procedure ViewCurrentStatus
  1835. Var Key
  1836.  
  1837.    UseArrows Off
  1838.  
  1839.    MakeBox('Current Status', 0, 8, 70, 8, Util)
  1840.  
  1841.    WriteStatus(" Password to edit menu...................[" + ModifyPassWord, 1)
  1842.    WriteStatus(" Password to exit to DOS.................[" + ExitToDosPassWord,2)
  1843.    WriteStatus(" Password for DOS utilities..............[" + DosUtilPassWord,3)
  1844.    WriteStatus(" Batch File Editor.................................[" + BatEditor,4)
  1845.    Writeln
  1846.    Writeln
  1847.    WriteCenter("<*> Press any key to continue <*>")
  1848.  
  1849.    Key = GetKey
  1850.  
  1851.    EraseTopWindow
  1852.  
  1853.    UseArrows ON
  1854.  
  1855. EndProc ;ViewCurrentStatus
  1856.  
  1857. ;---
  1858.  
  1859. Procedure GetKey
  1860. Var Tmp
  1861.    Repeat
  1862.       Tmp = UpperCase(ReadKey)
  1863.       if Tmp = '?'   then KeyHelp
  1864.       if Tmp = F1
  1865.          Help
  1866.       else
  1867.          if (Tmp = F2)
  1868.             SaveChanges
  1869.             if MMActive
  1870.                EraseTopWindow
  1871.                Draw
  1872.             endif
  1873.          else
  1874.             if Tmp = (Char(0) + '-')
  1875.                if EnterPassWord(ExitToDosPassWord, 6)
  1876.                   ExitMenu
  1877.                else
  1878.                   if MMActive
  1879.                      EraseTopWindow
  1880.                      Draw
  1881.                   endif
  1882.                endif
  1883.             else
  1884.                Return Tmp
  1885.             endif
  1886.          endif
  1887.       endif
  1888.       Tmp = ''
  1889.    Until Tmp > ''
  1890.  
  1891. EndProc
  1892.  
  1893. ;---
  1894.  
  1895. Procedure KeyHelp
  1896.  
  1897.    MakeBox(' Mini Help ', 0, 0, 31, 14, Util)
  1898.  
  1899.    Writeln
  1900.    Writeln('  F1    | Help')
  1901.    Writeln('  F2    | Save')
  1902.    Writeln('  F3    | Dos Utilities')
  1903.    Writeln('  F4    | Menu Utilities')
  1904.    Writeln('  F10   | Modify Menu')
  1905.    Writeln('  Alt S | Screen Setup')
  1906.    Writeln('  Alt X | Immediate Exit')
  1907.    Writeln('  ?     | This help screen')
  1908.    Writeln
  1909.    Write  ('   <*> Press any key <*>')
  1910.  
  1911.    WaitOrKbdReady (4500)
  1912.  
  1913.    EraseTopWindow
  1914.  
  1915.    if MMActive
  1916.       EraseTopWindow
  1917.       Draw
  1918.    endif
  1919.  
  1920. EndProc ;KeyHelp
  1921.  
  1922. { End of Support Routines }
  1923.